package com.sprouting.personal.service;

import cn.hutool.core.date.DateTime;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sprouting.personal.dao.MenstruationDao;
import com.sprouting.personal.model.entity.Menstruation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * 月经情况
 *
 * @author ：LX（长沙麓谷）
 * @date 创建时间： 2023/1/29 16:32
 */
@Service
@Slf4j
public class MenstruationService extends ServiceImpl<MenstruationDao, Menstruation> {

    @Resource
    private MenstruationDao menstruationDao;

    /**
     * 根据月经日期查询
     * @param userId 当前登录用户
     * @param menstruationTime 月经时间
     * @return
     */
    public Menstruation getMenstruationByTime(String userId, Date menstruationTime) {
        return menstruationDao.getMenstruationByTime(userId, menstruationTime);
    }

    /**
     * 查询区间范围内的数据
     * @param userId 当前登录用户
     * @param beforeStart 开始时间
     * @param afterEnd 结束时间
     * @return
     */
    public List<Menstruation> getMenstruationSectionTime(String userId, DateTime beforeStart, DateTime afterEnd) {
        return menstruationDao.getMenstruationSectionTime(userId, beforeStart, afterEnd);
    }
}
